﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Ninject;
using Legazpi.Payroll.Services.Interfaces;
using Legazpi.Payroll.Web.Admin;

namespace Legazpi.Payroll.Web.PopupBoxes
{
    public partial class PharaphernaliaDialogBox : System.Web.UI.Page
    {
        [Inject]
        public IPharaphernaliaService _pharaphernaliaService { get; set; }

        protected Emz.Core.Models.Pharaphernalia  Model { get; private set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                int id;
                int.TryParse(Request.QueryString["id"], out id);
                if (id > 0)
                {
                    //Update Data
                    Model = _pharaphernaliaService.GetById(id);
                }
            }
            Model = Model ?? new Emz.Core.Models.Pharaphernalia { Id = 0 };
        }
    }
}